﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SQLite;
using System.Data;

namespace post.dll
{
    class dbhelp
    {
        string path = "Data Source="+System.Environment.CurrentDirectory+"/db/all.db;Version=3;";

        public DataTable select(SQLiteCommand comm)
        {
            DataTable dt = new DataTable();
            using (SQLiteConnection conn=new SQLiteConnection(path))
            {
                conn.Open();
                comm.Connection = conn;
                SQLiteDataAdapter adpter = new SQLiteDataAdapter(comm);
                adpter.Fill(dt);
            }
            return dt;
        }
        public Boolean up(SQLiteCommand comm)
        {
            Boolean temp = false;
            using (SQLiteConnection conn=new SQLiteConnection(path))
            {
                conn.Open();
                comm.Connection = conn;
                temp=comm.ExecuteNonQuery() >0 ? true : false;
            }
            return temp;
        }

    }
}
